<template>
    <div>
<h1>医生信息列表展示</h1>
<table class="table">
<thead>
<tr>
    <td>医生名称</td>
    <td>医生所属科室</td>
    <td>医生信息创建时间</td>
    <td>医生头像</td>
</tr>
</thead>

<tbody>
    <tr v-for="a in da">
    <td>{{a.yiName}}</td>
    <td>{{a.ksName}}</td>
    <td>{{a.yiCreateTime}}</td>
    <td>
        <img :src="'https://localhost:7120/'+a.touXiang"  style="height: 60px;width: 60px;">
    </td>
</tr>
</tbody>
<tbody>

</tbody>
</table>

总共{{pa.zongtiao}}条，总共{{pa.zongye}}页，当前第{{can.pageindex}}页，每页{{can.pagesize}}条数据
<input type="button" value="首页" @click="feny(1)">
<input type="button" value="上一页" @click="feny(can.pageindex-1)">
<input type="button" value="下一页" @click="feny(can.pageindex+1)">
<input type="button" value="尾页" @click="feny(pa.zongye)">
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const uc=useRouter()

const da=ref([{
      "yiName": "",
      "touXiang": "",
      "keShiId": 0,
      "yiCreateTime": "2025-05-19T12:39:31.8175319",
      "yiSId": 0,
      "ksName": ""
    }])

    onMounted(()=>{
        showw()
    })

const can=ref({
    pageindex:1,
    pagesize:2
})

const pa=ref({
    zongtiao:0,
    zongye:0
})

//显示
    const showw=()=>{
        axios.get("/api/YiS/ShowYi",{params:can.value}).then(res=>{
            da.value=res.data.plist
            pa.value.zongtiao=res.data.coun
            pa.value.zongye=Math.ceil(pa.value.zongtiao/can.value.pagesize)

        })
    }

//分页
const feny=(x:any)=>{
    if(x>=1&&x<=pa.value.zongye){
        can.value.pageindex=x;
        showw()
    }
}
</script>

<style scoped>

</style>